/**
 *Copyright (c) 2024 watereyes
 * safetymanagement is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */
package com.koron.risk.mapper;


import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.koron.risk.bean.SourceQueryBean;
import com.koron.risk.domain.LocalHazardSource;

public interface LocalHazardSourceMapper {
    Integer insert(@Param("tableName") String tableName, @Param("bean") LocalHazardSource bean);

    Integer batchInsert(@Param("tableName") String tableName, @Param("beanList") List<LocalHazardSource> beanList);

    Integer deleteById(@Param("tableName") String tableName, @Param("id") String id);

    Integer deleteByIdList(@Param("tableName") String tableName, @Param("idList") List<String> idList);

    Integer update(@Param("tableName") String tableName, @Param("bean") LocalHazardSource bean);

    LocalHazardSource getDetails(@Param("tableName") String tableName, @Param("id") String id);

    List<LocalHazardSource> list(SourceQueryBean queryBean);

    Integer count(SourceQueryBean queryBean);
    
    Integer updateFstatusflag(@Param("idList") List<String> idList, @Param("fstatusflag") Integer fstatusflag);

    Integer updateState(@Param("idList") List<String> idList, @Param("state") Integer state);

    LocalHazardSource queryByCode(@Param("tableName") String tableName, @Param("code") String code);

    List<LocalHazardSource> queryByIdList(@Param("tableName") String tableName, @Param("idList") List<String> idList);

    Integer updateDisposalState(@Param("idList") List<String> idList, @Param("disposalState") Integer disposalState);

    @Select("select * from local_hazard_source_history where fstatusflag=0 and add_user=#{userCode}")
    List<LocalHazardSource> getDraftList(@Param("userCode") String userCode);

    @Select("select * from local_hazard_source_history where code=#{code} and fstatusflag=2")
    List<LocalHazardSource> queryHstory(@Param("code") String code);
    
    @Delete("delete from local_hazard_source_history where id=#{id}")
    Integer deleteDraft(@Param("id") String id);
    
    @Update("update local_hazard_source_history set code=#{code} where id=#{id}")
    Integer updateCode(@Param("id") String id,@Param("code") String code);
}
